import React from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
import router from './router';
import { RouterProvider } from 'react-router-dom';

import './theme.css'

import { Provider } from 'react-redux';
import store from './store';

// antd-mobile 不兼容react19
// import { unstableSetRender } from 'antd-mobile'; // Support since version ^5.40.0
// import { createRoot } from 'react-dom/client';

// unstableSetRender((node, container) => {
//   container._reactRoot ||= createRoot(container);
//   const root = container._reactRoot;
//   root.render(node);
//   return async () => {
//     await new Promise((resolve) => setTimeout(resolve, 0));
//     root.unmount();
//   };
// });

const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
  <Provider store={store}>
      <RouterProvider router={router}></RouterProvider>
  </Provider>
);
// const container = document.getElementById('root');
// const node = <RouterProvider router={router}></RouterProvider>
// unstableSetRender(node, container)